package com.fyt.recover.order;

public class QuikSortbyYanweiming {
    public static void sort( int []arr,int low,int high ) {

      if(low<high){
          int pivot=   patition(arr,low,high);
          sort(arr,low,pivot-1);
          sort(arr,pivot+1,high);}

        return;
    }

    public static int patition( int []arr,int low,int high ){
         int temp=arr[low];

         while (low<high){
             while (low<high&&arr[high]>=temp){high--;}
             arr[low]=arr[high];
             while (low<high&&arr[low]<=temp){low++;}
             arr[high]=arr[low];

         }
       arr[low]=temp;
         return high;

    }

    public static void startSort(int [] arr){
        sort(arr,0,arr.length-1);

    }
}
